#pragma  once
#include <string>
#include "LiveServer.h"
#include "FFMpegPusher.h"

namespace ZYLive {
    class LiveService {
    public:
        LiveService();
        ~LiveService();
        void setPushInfo(std::string url);
        bool setVideoInfo(int width, int height, int fps,float bitrate = 1*1024*1024);
        int pushVideoData(uint8_t* pData,int format,int width,int height);
        std::string getUrl();


    private:
        bool initServer();
        bool createPusher(int &width,int &height,int &fps,float &bitrate);

        std::shared_ptr<LiveServer> mServer = nullptr;

        std::shared_ptr<FFMpegPusher> mPusher = nullptr;
        bool mIsInitPusher = false;

        std::string mUrl= std::string();
        int mWidth = 0;
        int mHeight = 0 ;
        int mFps = 0;
        float mBitRate = 0 ;

        int mPushType  = 0; // 0:rtmp;1:rtsp

    };
}

